home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / yacas_alg / yacas_morphos / share / yacas / include / ramdisk.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-13  |  1.3 KB  |  54 lines

  1.  
  2. /** \file ramdisk.h
  3.  *  LispRamDisk implements an in-memory file system by deriving from
  4.  *  LispAssociatedHash.
  5.  *
  6.  * This LispAssociatedHash implementation associates a string (the file
  7.  *  name) to another string (the contents of the file). As such it can
  8.  *  be used as a file system. The LispRamFile can even be used to hard-code
  9.  *  the standard math library scripts into the executable, by adding
  10.  *  the strings to the LispRamFile at startup. This is platform-independent
  11.  *  also.
  12.  */
  13.  
  14. #ifndef __ramdisk_h__
  15. #define __ramdisk_h__
  16.  
  17. #include "yacasbase.h"
  18. #include "lisphash.h"
  19. #include "lispstring.h"
  20. #include "grower.h"
  21.  
  22. /** class representing the contents of a file. See LispRamDisk for
  23.  *  more details.
  24.  */
  25. class LispRamFile : public YacasBase
  26. {
  27. public:
  28.     LispRamFile(LispCharPtr aFileContents)
  29.         : iFileContents(aFileContents,LispTrue)
  30.     {
  31.     };
  32.     LispRamFile(const LispRamFile& orig)
  33.         : iFileContents(orig.iFileContents.String(),LispTrue)
  34.         {
  35.         };
  36.     ~LispRamFile() {};
  37.     LispStringPtr Contents()
  38.     {
  39.         return &iFileContents;
  40.     }
  41. private:
  42.     LispString iFileContents;
  43. };
  44.  
  45. /** class maintaining a set of object instantiations of the
  46.  *  class LispRamFile. As such it acts as an in-memory file system.
  47.  */
  48. class LispRamDisk : public LispAssociatedHash<LispRamFile>
  49. {
  50. };
  51.  
  52. #endif
  53.  
  54.